// see http://vuejs-templates.github.io/webpack for documentation.
var path = require('path')
var isProd = process.env.NODE_ENV === 'production'
module.exports = {
  build: {
    env: require('./prod.env'),
    index: path.resolve(__dirname, '../dist/index.html'),
    assetsRoot: path.resolve(__dirname, '../dist'),
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',
    productionSourceMap: true,
    // Gzip off by default as many popular static hosts such as
    // Surge or Netlify already gzip all static assets for you.
    // Before setting to `true`, make sure to:
    // npm install --save-dev compression-webpack-plugin
    productionGzip: false,
    productionGzipExtensions: ['js', 'css']
  },
  dev: {
    env: require('./dev.env'),
    port: 8080,
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',
    proxyTable: {
      '^/apiv1/**': 'http://192.168.3.108:18082'
    },
    // CSS Sourcemaps off by default because relative paths are "buggy"
    // with this option, according to the CSS-Loader README
    // (https://github.com/webpack/css-loader#sourcemaps)
    // In our experience, they generally work as expected,
    // just be aware of this issue when enabling this option.
    cssSourceMap: true
  },
  webpack: {
    entry: {
      app: './src/views/app/app.js',
      signin: './src/views/signin/signin.js',
      signup: './src/views/signup/signup.js',
      findpwd: './src/views/findpwd/findpwd.js'
    },
    template: [{
      filename: isProd ? path.resolve(__dirname, '../dist/index.html') : 'index.html',
      template: './src/views/app/app.html',
      inject: true,
      chunks: ['manifest', 'vendor', 'app'],
      // necessary to consistently work with multiple chunks via CommonsChunkPlugin
      chunksSortMode: 'dependency'
    }, {
      filename: isProd ? path.resolve(__dirname, '../dist/signup.html') : 'signup.html',
      template: './src/views/signup/signup.html',
      inject: true,
      chunks: ['manifest', 'vendor', 'signup'],
      // necessary to consistently work with multiple chunks via CommonsChunkPlugin
      chunksSortMode: 'dependency'
    }, {
      filename: isProd ? path.resolve(__dirname, '../dist/signin.html') : 'signin.html',
      template: './src/views/signin/signin.html',
      inject: true,
      chunks: ['manifest', 'vendor', 'signin'],
      // necessary to consistently work with multiple chunks via CommonsChunkPlugin
      chunksSortMode: 'dependency'
    }, {
      filename: isProd ? path.resolve(__dirname, '../dist/findpwd.html') : 'findpwd.html',
      template: './src/views/findpwd/findpwd.html',
      inject: true,
      chunks: ['manifest', 'vendor', 'findpwd'],
      // necessary to consistently work with multiple chunks via CommonsChunkPlugin
      chunksSortMode: 'dependency'
    }]
  }
}
